package chen.you.comm.log

/**
 * author: you : 2018/12/27
 */
class MultiLogger : Logger {

    private val loggerList = ArrayList<Logger>()

    fun addLogger(logger: Logger) {
        loggerList.add(logger)
    }

    fun removeLogger(logger: Logger) {
        loggerList.remove(logger)
    }

    override fun println(level: Int, tag: String, msg: String) {
        loggerList.forEach { it.println(level, tag, msg) }
    }

    override fun flush() {
        loggerList.forEach { it.flush() }
    }

    override fun release() {
        loggerList.forEach { it.release() }
    }
}